package com.macro.mall.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.macro.mall.dao.UmsMemberReceiveAddressDao;
import com.macro.mall.model.UmsMember;
import com.macro.mall.model.UmsMemberReceiveAddress;
import com.macro.mall.service.UmsMemberReceiveAddressService;
import com.macro.mall.service.UserMemberService;
import com.macro.mall.uitls.AddressInfoUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author：MinxiaoHao
 * @Description:
 * @name：UmsMemberReceiveAddressService
 * @Date：2024/10/22 21:42
 */

@Service
public class UmsMemberReceiveAddressServiceImpl  extends ServiceImpl<UmsMemberReceiveAddressDao, UmsMemberReceiveAddress>  implements UmsMemberReceiveAddressService {
    @Autowired
    private AddressInfoUtils addressInfoUtils;
    @Autowired
    private UmsMemberReceiveAddressDao umsMemberReceiveAddressDao;
    @Autowired
    private UserMemberService userMemberService;

    /**
     * 快递识别
     * @param addressInfo 快递信息
     */
    @Override
    public UmsMemberReceiveAddress identification(String addressInfo) {
        return addressInfoUtils.getAddressInfo(addressInfo);
    }

    /**
     * 获取收货地址列表
     */
    @Override
    public List<UmsMemberReceiveAddress> selectList() {
        //获取C端用户信息
        UmsMember currentAdmin = userMemberService.getCurrentAdmin();
        return umsMemberReceiveAddressDao.addressList(currentAdmin.getId());
    }
}
